package com.hutao.manage.pojo;

import java.text.ParseException;
import java.util.Date;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;

import com.hutao.manage.util.DateUtil;
import com.hutao.manage.util.MapUtil;
import com.hutao.manage.util.ObjectUtil;
import com.hutao.manage.util.StringUtil;

public class MedicalBasicTemplate {
	private String onlyId;
	private String mrId;
	private Integer visitNumber;
	private String visitGuid;
	private String idNumber;
	private String patientName;
	private String sexCode;
	private String sexName;
	private Integer sexId;
	private Date birthday;
	private String inHospitalTypeCode;
	private String inHospitalTypeName;
	private Integer inHospitalTypeId;
	private Date inHospitalDateTime;
	private String inHospitalDateTimeStr;
	private String inDeptCode;
	private String inDeptName;
	private Integer inDeptId;
	private String outDeptCode;
	private String outDeptName;
	private Integer outDeptId;
	private Date outHospitalDateTime;
	private String outHospitalDateTimeStr;
	private String outHospitalTypeCode;
	private String outHospitalTypeName;
	private Integer outHospitalTypeId;
	private String citizensGuid;
	
	public static MedicalBasicTemplate getMedicalBasicTemplate(Map<String, Object> data) {
		MedicalBasicTemplate medicalBasicTemplate = new MedicalBasicTemplate();
		
		String onlyId = MapUtil.getStringTypeValueTrim(data, MedicalBasicKey.ONLYID);
		medicalBasicTemplate.setOnlyId(onlyId);
		
		String mrId = MapUtil.getStringTypeValueTrim(data, MedicalBasicKey.MRID);
		medicalBasicTemplate.setMrId(mrId);
		
		Integer visitNumber = ObjectUtil.getIntegerValue(data.get(MedicalBasicKey.VISITNUMBER));
		medicalBasicTemplate.setVisitNumber(visitNumber);
		
		medicalBasicTemplate.setVisitGuid(StringUtil.getId());
		medicalBasicTemplate.setCitizensGuid(StringUtil.getId());
		String idNumber = MapUtil.getStringTypeValueTrim(data, MedicalBasicKey.IDNUMBER); 
		medicalBasicTemplate.setIdNumber(idNumber);
		
		String patientName = MapUtil.getStringTypeValueTrim(data, MedicalBasicKey.PATIENTNAME); 
		medicalBasicTemplate.setPatientName(patientName);
		
		String sexCode = MapUtil.getStringTypeValueTrim(data, MedicalBasicKey.SEXCODE);
		medicalBasicTemplate.setSexCode(sexCode);
		
		String sexName = MapUtil.getStringTypeValueTrim(data, MedicalBasicKey.SEXNAME);
		medicalBasicTemplate.setSexName(sexName);
		
		String birthdayStr = MapUtil.getStringTypeValueTrim(data, MedicalBasicKey.BIRTHDAY);
		if (StringUtils.isNotBlank(birthdayStr)) {
			try {
				medicalBasicTemplate.setBirthday(DateUtil.dateParse(birthdayStr));
			} catch (ParseException e) {
				e.printStackTrace();
			}
		}
		
		String inHospitalTypeCode = MapUtil.getStringTypeValueTrim(data, MedicalBasicKey.INHOSPITALTYPECODE);
		medicalBasicTemplate.setInHospitalTypeCode(inHospitalTypeCode);
		
		String inHospitalTypeName = MapUtil.getStringTypeValueTrim(data, MedicalBasicKey.INHOSPITALTYPENAME);
		medicalBasicTemplate.setInHospitalTypeName(inHospitalTypeName);
		
		String inHospitalDateTimeStr = MapUtil.getStringTypeValueTrim(data, MedicalBasicKey.INHOSPITALNDATETIME);
		medicalBasicTemplate.setInHospitalDateTimeStr(inHospitalDateTimeStr);
		if (StringUtils.isNotBlank(inHospitalDateTimeStr)) {
			try {
				medicalBasicTemplate.setInHospitalDateTime(DateUtil.dateParse(DateUtil.DATE_FORMATE, inHospitalDateTimeStr));
			} catch (ParseException e) {
				e.printStackTrace();
			}
		}
		
		String inDeptCode = MapUtil.getStringTypeValueTrim(data, MedicalBasicKey.INDEPTCODE);
		medicalBasicTemplate.setInDeptCode(inDeptCode);
		
		String inDeptName = MapUtil.getStringTypeValueTrim(data, MedicalBasicKey.INDEPTNAME);
		medicalBasicTemplate.setInDeptName(inDeptName);
		
		String outDeptCode = MapUtil.getStringTypeValueTrim(data, MedicalBasicKey.OUTDEPTCODE);
		medicalBasicTemplate.setOutDeptCode(outDeptCode);
		
		String outDeptName = MapUtil.getStringTypeValueTrim(data, MedicalBasicKey.OUTDEPTNAME);
		medicalBasicTemplate.setOutDeptName(outDeptName);
		
		String outHospitalDateTimeStr = MapUtil.getStringTypeValueTrim(data, MedicalBasicKey.OUTHOSPITALDATETIME);
		medicalBasicTemplate.setOutHospitalDateTimeStr(outHospitalDateTimeStr);
		if (StringUtils.isNotBlank(outHospitalDateTimeStr)) {
			try {
				medicalBasicTemplate.setOutHospitalDateTime(DateUtil.dateParse(DateUtil.DATE_FORMATE, outHospitalDateTimeStr));
			} catch (ParseException e) {
				e.printStackTrace();
			}
		}
		
		String outHospitalTypeCode = MapUtil.getStringTypeValueTrim(data, MedicalBasicKey.OUTHOSPITALTYPECODE);
		medicalBasicTemplate.setOutHospitalTypeCode(outHospitalTypeCode);
		
		String outHospitalTypeName = MapUtil.getStringTypeValueTrim(data, MedicalBasicKey.OUTHOSPITALTYPENAME);
		medicalBasicTemplate.setOutHospitalTypeName(outHospitalTypeName);
		
		return medicalBasicTemplate;
	}
	
	
	public String getIdNumber() {
		return idNumber;
	}
	public void setIdNumber(String idNumber) {
		this.idNumber = idNumber;
	}
	public String getPatientName() {
		return patientName;
	}
	public void setPatientName(String patientName) {
		this.patientName = patientName;
	}
	public String getSexCode() {
		return sexCode;
	}
	public void setSexCode(String sexCode) {
		this.sexCode = sexCode;
	}
	public String getSexName() {
		return sexName;
	}
	public void setSexName(String sexName) {
		this.sexName = sexName;
	}
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public String getInHospitalTypeCode() {
		return inHospitalTypeCode;
	}
	public void setInHospitalTypeCode(String inHospitalTypeCode) {
		this.inHospitalTypeCode = inHospitalTypeCode;
	}
	public String getInHospitalTypeName() {
		return inHospitalTypeName;
	}
	public void setInHospitalTypeName(String inHospitalTypeName) {
		this.inHospitalTypeName = inHospitalTypeName;
	}
	public Date getInHospitalDateTime() {
		return inHospitalDateTime;
	}
	public void setInHospitalDateTime(Date inHospitalDateTime) {
		this.inHospitalDateTime = inHospitalDateTime;
	}
	public String getInDeptCode() {
		return inDeptCode;
	}
	public void setInDeptCode(String inDeptCode) {
		this.inDeptCode = inDeptCode;
	}
	public String getInDeptName() {
		return inDeptName;
	}
	public void setInDeptName(String inDeptName) {
		this.inDeptName = inDeptName;
	}
	public String getOutDeptCode() {
		return outDeptCode;
	}
	public void setOutDeptCode(String outDeptCode) {
		this.outDeptCode = outDeptCode;
	}
	public String getOutDeptName() {
		return outDeptName;
	}
	public void setOutDeptName(String outDeptName) {
		this.outDeptName = outDeptName;
	}
	public Date getOutHospitalDateTime() {
		return outHospitalDateTime;
	}
	public void setOutHospitalDateTime(Date outHospitalDateTime) {
		this.outHospitalDateTime = outHospitalDateTime;
	}
	public String getOutHospitalTypeCode() {
		return outHospitalTypeCode;
	}
	public void setOutHospitalTypeCode(String outHospitalTypeCode) {
		this.outHospitalTypeCode = outHospitalTypeCode;
	}
	public String getOutHospitalTypeName() {
		return outHospitalTypeName;
	}
	public void setOutHospitalTypeName(String outHospitalTypeName) {
		this.outHospitalTypeName = outHospitalTypeName;
	}

	public String getVisitGuid() {
		return visitGuid;
	}

	public void setVisitGuid(String visitGuid) {
		this.visitGuid = visitGuid;
	}


	public Integer getSexId() {
		return sexId;
	}


	public void setSexId(Integer sexId) {
		this.sexId = sexId;
	}


	public String getCitizensGuid() {
		return citizensGuid;
	}


	public void setCitizensGuid(String citizensGuid) {
		this.citizensGuid = citizensGuid;
	}


	public String getOnlyId() {
		return onlyId;
	}


	public void setOnlyId(String onlyId) {
		this.onlyId = onlyId;
	}


	public String getMrId() {
		return mrId;
	}


	public void setMrId(String mrId) {
		this.mrId = mrId;
	}


	public Integer getVisitNumber() {
		return visitNumber;
	}


	public void setVisitNumber(Integer visitNumber) {
		this.visitNumber = visitNumber;
	}


	public Integer getInDeptId() {
		return inDeptId;
	}


	public void setInDeptId(Integer inDeptId) {
		this.inDeptId = inDeptId;
	}


	public Integer getOutDeptId() {
		return outDeptId;
	}


	public void setOutDeptId(Integer outDeptId) {
		this.outDeptId = outDeptId;
	}


	public Integer getInHospitalTypeId() {
		return inHospitalTypeId;
	}


	public void setInHospitalTypeId(Integer inHospitalTypeId) {
		this.inHospitalTypeId = inHospitalTypeId;
	}


	public Integer getOutHospitalTypeId() {
		return outHospitalTypeId;
	}


	public void setOutHospitalTypeId(Integer outHospitalTypeId) {
		this.outHospitalTypeId = outHospitalTypeId;
	}


	public String getInHospitalDateTimeStr() {
		return inHospitalDateTimeStr;
	}


	public void setInHospitalDateTimeStr(String inHospitalDateTimeStr) {
		this.inHospitalDateTimeStr = inHospitalDateTimeStr;
	}


	public String getOutHospitalDateTimeStr() {
		return outHospitalDateTimeStr;
	}


	public void setOutHospitalDateTimeStr(String outHospitalDateTimeStr) {
		this.outHospitalDateTimeStr = outHospitalDateTimeStr;
	}
	
	
	
	
	
	
	

}




